﻿using System;
using System.Data;

using BLL;
using Utility;

namespace EvaluationSystem
{
    public partial class QuestionRepeater : System.Web.UI.Page
    {
        private string m_actid = string.Empty;
      
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request["actid"] != null)
                {
                    m_actid = Request["actid"].ToString();
                    Session["actid"] = m_actid;
                    bind();
                }
            }
        }

        private void bind()
        {
            QuestionBLL qbl = new QuestionBLL();
            DataSet dsQuestion = qbl.GetQuestionByActivityIDRand(m_actid);

            if (dsQuestion != null && dsQuestion.Tables[0].Rows.Count > 0)
            {
                rpCust.DataSource = GenerateGuid.SelectTop(20, dsQuestion.Tables[0]);
                rpCust.DataBind();
            }
            else
            {
                Response.Write("<script language='javascript'>alert('没有相应的题目，请检查该测评项目的维度设置！');</script>");
                Response.Write("<script language='javascript'>window.close()</script>");
            }
        }

        protected void btn_click(object sender, EventArgs e)
        {
            Response.Redirect("ManageActivity.aspx");
        }
    }
}